package com.zhuangjie.user.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 收货地址表
 * </p>
 *
 * @author zhuangjie
 * @since 2023-10-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("address_book")
@ApiModel(value="AddressBook对象", description="收货地址表")
public class AddressBook implements Serializable {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "地址id")
      @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty(value = "用户表_用户id")
    @TableField("user_id")
    private Long userId;

    @ApiModelProperty(value = "收货人")
    @TableField("consignee")
    @NotBlank(message = "收货人不能为空")
    private String consignee;

    @ApiModelProperty(value = "性别(0女，1男)")
    @TableField("sex")
    @NotNull(message = "性别需要指定")
    private Integer sex;

    @ApiModelProperty(value = "手机号码")
    @TableField("phone")
    @NotBlank(message = "手机号码不能为空")
    @Pattern(regexp = "^[1-9]\\d{10}$", message = "手机号码无效")
    private String phone;

    @ApiModelProperty(value = "经度")
    @TableField("longitude")
    @NotBlank(message = "无效的经度")
    private Double longitude;

    @ApiModelProperty(value = "纬度")
    @NotBlank(message = "无效的纬度")
    @TableField("latitude")
    private Double latitude;

    @ApiModelProperty(value = "省份编码")
    @TableField("province_code")
    @NotBlank(message = "无效的省份编码")
    private String provinceCode;

    @ApiModelProperty(value = "省份名称")
    @NotBlank(message = "无效的省份名称")
    @TableField("province_name")
    private String provinceName;

    @ApiModelProperty(value = "城市编码")
    @TableField("city_code")
    @NotBlank(message = "无效的城市编码")
    private String cityCode;

    @ApiModelProperty(value = "城市名称")
    @TableField("city_name")
    @NotBlank(message = "无效的城市名称")
    private String cityName;

    @ApiModelProperty(value = "区县编码")
    @TableField("district_code")
    @NotBlank(message = "无效的区县编码")
    private String districtCode;

    @ApiModelProperty(value = "区县名称")
    @NotBlank(message = "无效的区县名称")
    @TableField("district_name")
    private String districtName;

    @ApiModelProperty(value = "详细地址信息")
    @TableField("detail_address")
    @NotBlank(message = "无效的详细地址信息")
    private String detailAddress;

    @ApiModelProperty(value = "具体地址（比如几楼几门牌号）")
    @TableField("specific_address")
    private String specificAddress;


    @ApiModelProperty(value = "上次使用时间")
    @TableField("last_used_time")
    private LocalDateTime lastUsedTime;

    @ApiModelProperty(value = "标签")
    @TableField("label")
    private String label;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 逻辑删除
     */
    @ApiModelProperty(value = "逻辑删除")
    @TableField(value = "deleted",fill = FieldFill.INSERT)
    @TableLogic
    private Integer deleted;


}
